package com.zut.yyzx.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zut.yyzx.dto.KhxxDTO;
import com.zut.yyzx.pojo.Customer;
import com.zut.yyzx.service.CustomerService;
import com.zut.yyzx.utils.ResultVo;
import com.zut.yyzx.vo.KhxxCustomerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/customer")
@CrossOrigin
//"客户管理"
public class CustomerController {
    @Autowired
    private CustomerService customerService;

    //"入住登记"
    @PostMapping("/rzdj")
    public ResultVo addCustomer(Customer customer) throws  Exception{
        return customerService.addCustomer(customer);
    }

    @GetMapping("/listKhxxPage")
    //"客户信息动态查询（分页）"
    public ResultVo<Page<KhxxCustomerVo>> listKhxxPage(KhxxDTO khxxDTO) throws Exception{
        return customerService.khxxFindCustomer(khxxDTO);
    }


    @GetMapping("/remove")
    //"根据key删除"
    public ResultVo remove(Integer id,Integer bedId) throws Exception{
        return customerService.removeCustomer(id,bedId);
    }

    @PostMapping("/editKhxx")
    //"编辑客户信息"
    public ResultVo editKhxx(Customer customer) throws Exception{
        return customerService.editCustomer(customer);
    }
}
